'use strict';

import React, { Component } from 'react';
import { StackNavigator } from 'react-navigation';
import { createStore } from 'redux';
import { Provider, connect } from 'react-redux'
import { Root, StyleProvider, Spinner } from "native-base";
import Reducers from '../reducers/reducers.js';
import '../public/storage.js';
import LoginPage from '../pages/LoginPage.js';

class MainNavigator extends Component {
    render() {
        const SINavigator = StackNavigator({
            Login: { screen: LoginPage },
        }, {
                initialRouteName: 'Login',
                headerMode: 'none'
            });
        return (<SINavigator />);
    }
}

const store = createStore(Reducers);

class RootNavigator extends Component {
    constructor(props) {
        super(props);
    }

    componentWillMount() {
    }

    componentDidMount() {
    }

    componentWillUnmount() {
    }

    render() {
        return (
            <Provider store={store}>
                <StyleProvider >
                    <Root>
                        <MainNavigator />
                    </Root>
                </StyleProvider>
            </Provider>
        );
    }
}

export default RootNavigator;
